//
//  AppConfig.h
//  bus
//
//  Created by hychen on 17/3/30.
//  Copyright © 2017年 Hychen. All rights reserved.
//

#ifndef BAppConfig_h
#define BAppConfig_h

// app版本
#define Version_bb  [NSString stringWithFormat:@"%@",[[[NSBundle mainBundle] infoDictionary] \
objectForKey:@"CFBundleShortVersionString"]]
// 是否是新版本key
#define Key_Version_IsNew                           @"Key_Version_IsNew"
// 是否是新版本
#define IsNewVersion_bb     [[[NSUserDefaults standardUserDefaults] objectForKey:Key_Version_IsNew] boolValue]

#define kStatusBarAndNavBarHeight [BMUtility statusBarAndNavBarHeight]
#define kTabbarHeight [BMUtility tabbarHeight]
#define kNavBarHeight [BMUtility NavBarHeight]
#define kStatusBarHeight [BMUtility statusBarHeight]

// 系统版本
#define IOS7_bb     ([[UIDevice currentDevice].systemVersion floatValue] >= 7.0)
#define IOS8_bb     ([[UIDevice currentDevice].systemVersion floatValue] >= 8.0)
#define IOS9_bb     ([[UIDevice currentDevice].systemVersion floatValue] >= 9.0)
#define IOS10_bb    ([[UIDevice currentDevice].systemVersion floatValue] >= 10.0)

#define Show_SV_Success_Msg(msg)    [SVProgressHUD showSuccessWithStatus:msg];
#define Show_SV_Error_Msg(msg)      [SVProgressHUD showErrorWithStatus:msg];
#define Show_SV_Msg(msg)            [SVProgressHUD showWithStatus:msg];
#define Show_SV_NoMsg               [SVProgressHUD show];
#define Dismiss_SV_Msg              [SVProgressHUD dismiss];

//读取本地图片
#define Image_Ext_bb(file,ext) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle]pathForResource:file ofType:ext]]
//定义UIImage对象
#define Image_bb(A) [UIImage imageWithContentsOfFile:[[NSBundle mainBundle] pathForResource:A ofType:nil]]
//定义UIImage对象
#define ImageNamed_bb(imageName) [UIImage imageNamed:imageName]

// 设备型号
#define isPhone6P_bb ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? (CGSizeEqualToSize(CGSizeMake(1125, 2001), [[UIScreen mainScreen] currentMode].size) || CGSizeEqualToSize(CGSizeMake(1242, 2208), [[UIScreen mainScreen] currentMode].size)) : NO)

#define isPhone6_bb ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(750, 1334), [[UIScreen mainScreen] currentMode].size) : NO)

#define isPhone5_bb ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 1136), [[UIScreen mainScreen] currentMode].size) : NO)

#define isPhone4s_bb ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(640, 960), [[UIScreen mainScreen] currentMode].size) : NO)

#define isPhone4_bb ([UIScreen instancesRespondToSelector:@selector(currentMode)] ? CGSizeEqualToSize(CGSizeMake(320, 480), [[UIScreen mainScreen] currentMode].size) : NO)

#define WidthScreen [[UIScreen mainScreen] bounds].size.width
#define HeightScreen [[UIScreen mainScreen] bounds].size.height

/*! 空字符串 */
#define StringIsEmpty_bb(str) ([str isKindOfClass:[NSNull class]] || str == nil || [str length] < 1 ? YES : NO )
/*! 空数组 */
#define ArrayIsEmpty_bb(array) (array == nil || [array isKindOfClass:[NSNull class]] || array.count == 0)
/*! 空字典 */
#define DictIsEmpty_bb(dic) (dic == nil || [dic isKindOfClass:[NSNull class]] || dic.allKeys == 0)
/*! 空对象 */
#define ObjectIsEmpty_bb(_object) (_object == nil \
|| [_object isKindOfClass:[NSNull class]] \
|| ([_object respondsToSelector:@selector(length)] && [(NSData *)_object length] == 0) \
|| ([_object respondsToSelector:@selector(count)] && [(NSArray *)_object count] == 0))


#define Application_bb        [UIApplication sharedApplication]
#define KeyWindow_bb          [UIApplication sharedApplication].keyWindow
#define AppDelegate_bb        [UIApplication sharedApplication].delegate
#define UserDefaults_bb       [NSUserDefaults standardUserDefaults]
#define NotificationCenter_bb [NSNotificationCenter defaultCenter]

#endif /* AppConfig_h */
